#ifndef SWP_RESOURCE_EDITOR_H
#define SWP_RESOURCE_EDITOR_H

#include "abstractgraphiceditor.h"

namespace swp
{

class SwpResourceEditor : public AbstractGraphicEditor
{
    Q_OBJECT

public:
    SwpResourceEditor(QWidget* parent = 0);
    ~SwpResourceEditor();

    QStringList galleryGroups() const;
    QList<core::GalleryItem> galleryItems(const QString& group) const;

    IEditor* copy() const;

    bool eventFilter(QObject* watched, QEvent* event);

protected:
    void dragEnterEvent(QDragEnterEvent* event);
    void dragMoveEvent(QDragMoveEvent *event);
    void dropEvent(QDropEvent *event);

private:
    void createThumbnails();
    void createMimeData();
    void createActions();
    void connectSlots();

private slots:
    void createNewArtifact(QPoint where = QPoint());
    void createNewResource(QPoint where = QPoint());
    void createNewWorker(QPoint where = QPoint());
    void beginAggregation();
    void beginAssociation();
    void beginComposition();
    void beginDependency();
    void beginGeneralization();
    void beginRealization();

private:
    QAction* m_addArtifactAction;
    QAction* m_addResourceAction;
    QAction* m_addWorkerAction;
    QAction* m_createAggregationAction;
    QAction* m_createAssociationAction;
    QAction* m_createCompositionAction;
    QAction* m_createDependencyAction;
    QAction* m_createGeneralizationAction;
    QAction* m_createRealizationAction;

    QMimeData* m_artifactMimeData;
    QMimeData* m_resourceMimeData;
    QMimeData* m_workerMimeData;

    QPixmap m_artifactThumbnailDrag;
    QPixmap m_artifactThumbnailGallery;
    QPixmap m_resourceThumbnailDrag;
    QPixmap m_resourceThumbnailGallery;
    QPixmap m_workerThumbnailDrag;
    QPixmap m_workerThumbnailGallery;
    QPixmap m_aggregationThumbnailGallery;
    QBitmap m_aggregationThumbnailConnect;
    QPixmap m_associationThumbnailGallery;
    QBitmap m_associationThumbnailConnect;
    QPixmap m_compositionThumbnailGallery;
    QBitmap m_compositionThumbnailConnect;
    QPixmap m_dependencyThumbnailGallery;
    QBitmap m_dependencyThumbnailConnect;
    QPixmap m_generalizationThumbnailGallery;
    QBitmap m_generalizationThumbnailConnect;
    QPixmap m_realizationThumbnailGallery;
    QBitmap m_realizationThumbnailConnect;

    static const QString ACCEPTED_MIMETYPE;
    static const QString ARTIFACT_MIMETYPE_DATA;
    static const QString RESOURCE_MIMETYPE_DATA;
    static const QString WORKER_MIMETYPE_DATA;
};

}

#endif
